axios.defaults.headers.Authorization=localStorage.getItem('token') || ''
window.fmvm = new Vue({
    el:'#app',
    data: {
      data: [],
      activeName: 'first',
      main_title: '',
      
    },
  methods: {
    submin() {
      this.main_title =  window.parent.window.main_title
      let form = document.getElementById('answer')
      let formData = new FormData(form)
      formData.append("main_title",this.main_title)
      // console.log(this.main_title);
      axios.post('http://127.0.0.1:8000/my/answer', formData).then((res) => {
        console.log(res);
      })
    },
      handleClick(tab, event) {
        // const data= 'asd'
        axios.post('http://127.0.0.1:8000/api/get_homework_student').then( (res) => {
          this.data = res.data
        })  
        this.bb()
      },
      bb() {
        let data = window.parent.document.getElementById('tit')
        if (data) {
          data = data.innerHTML;
        } 
        axios.post('http://127.0.0.1:8000/api/get_homework_student',data).then( (res) => {
          if (res.data) {
            this.data = JSON.parse(res.data.homework)
            // console.log(this.data);
          }
          window.parent.document.getElementById('iframeBox').style.height = window.document.documentElement.offsetHeight + 200 + 'px'
          // console.log(window.parent.document.getElementById('iframeBox'), 'asdfasdf',  window.document.documentElement.offsetHeight)
        })  
      },
    },
    created() {
      this.bb()
    }
  })